package com.regedit.aplicacion.utils;

import org.json.JSONObject;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;

import com.regedit.aplicacion.controllers.CarroController;
import com.regedit.aplicacion.models.Carro;

public class InsertAutoTask extends AsyncTask<Carro , String , Boolean> {

	private Context mContext;
	private JSONObject mAuto;
	private ProgressDialog progressDialog;

	public InsertAutoTask(Context context, JSONObject auto){
		mContext = context;
		mAuto = auto;
	}
	@Override
	protected void onPreExecute() {
		
		progressDialog = ProgressDialog.show(mContext, "", "Cargando...");
		super.onPreExecute();
	}
	
	@Override
	protected Boolean doInBackground(Carro... params) {
		CarroController cController = new CarroController(mContext);
		boolean json = cController.insertAuto(mAuto);
		return json;
	}

	@Override
	protected void onPostExecute(Boolean result) {
		progressDialog.dismiss();
		super.onPostExecute(result);
	}

	
	
	

}
